﻿namespace FitnessTrackerUI.Command
{
    using System.Windows.Input;
    using FitnessTrackerUI.Commands;
    using FitnessTrackerUI.ViewModel;

    class ConnectHxMCommands
    {
        private DelegateCommand<ConnectToHxMViewModel> connectToHxMCommand;
        private ConnectToHxMViewModel connectToHxMViewModel;
        
        public ICommand ConnectToHxMCommand
        {
            get
            {
                return this.connectToHxMCommand
                       ?? (this.connectToHxMCommand = new DelegateCommand<ConnectToHxMViewModel>(
                           this.ConnecectToHxM));
            }
        }

        private void ConnecectToHxM(ConnectToHxMViewModel viewModel)
        {
            this.connectToHxMViewModel = viewModel;
            connectToHxMViewModel.AttemptConnection();
        }
    }
}
